<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/common/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.newslityle{
	position: relative;
    display: inline-block;
    vertical-align: middle;
    
    margin-right: 24px;
}
</style>
<script type="text/javascript">

	$(function(){
		var header_id = 0;
		var session_header_id = '${sessionScope.header_Identification}';
		if(session_header_id!=-1){
			header_id=session_header_id;
		}
		$(".layui-nav-item").eq(header_id).addClass("layui-this");
	});

	function logout() {
		layer.confirm('您确定要退出系统吗？', {
			btn : [ '确认', '取消' ]
		//按钮
		}, function() {
			window.location.href = "${ctx}/logout";
		}, function() {
			return;
		});
	}

	//切换分公司
	function changeComany(obj) {
		var top = $(obj).parent().parent().offset().top;
		var left = $(obj).parent().parent().offset().left;
		var height = $(obj).parent().height();
		
		var finalTop = parseInt(top) + parseInt(height);
		var finalLeft = parseInt($(window).width()) - 290;
		
		layer.open({
			type : 2,
			title : false,
			content :"${ctx}/user/selectCompanyPage",
			scrollbar :false,
			closeBtn :0,
			shadeClose:true,
			area : ['300px','500px'],
			offset : [finalTop,finalLeft]
		});
	}
	
	function winReload(){
		window.location.reload();
	}
	
	function checkSession(){
		var flag = "false";
		$.ajax({
			url : '${ctx}/checkSession', //服务器的地址
			dataType : 'text', //返回数据类型
			type : 'POST', //请求类型
			async:false,
			success : function(data) {
				flag = data;
			}
		});
		return flag;
	}
	
	(function($){
	    window.addEventListener("click",function(evt){
	    	if($.find("iframe")[0]){
	          if(checkSession()=="false"){
	        	  winReload();
	          }
	    	} 
	    },false);
	})(jQuery);
</script>

</head>
<body class="layui-layout-body">
	<div class="layui-header" style="margin: 0; min-width: 1345px;">
		<div class="layui-logo">
			<a href="${ctx}/index">
				<img style="width: 130px; height: 40px;" src="${ctx }/img/logo.jpg">
			</a>
		</div>
		<!-- 头部区域（可配合layui已有的水平导航） -->
		<ul class="layui-nav layui-layout-left">
			<li class="layui-nav-item"><a href="${ctx}/index?header_Identification=index">我的工作台</a></li>
			<shiro:hasPermission name="touchpoint:-">
			<li class="layui-nav-item"><a href="javascript:void(0);">触点规划</a>
				<dl class="layui-nav-child">
					<shiro:hasPermission name="touchpoint:touch">
					<dd>
						<a href="${ctx }/touch/all?header_Identification=touchpoint">触点管理</a>
					</dd>
					</shiro:hasPermission>
					<shiro:hasPermission name="touchpoint:TALL">
					<dd>
						<a href="${ctx }/touch/t/all/all?header_Identification=touchpoint">触点体系</a>
					</dd>
					</shiro:hasPermission>
				</dl></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="project:-">
			<li class="layui-nav-item"><a href="javascript:void(0);">项目管理</a>
				<dl class="layui-nav-child">
					<dd>
						<shiro:hasPermission name="project:infoManage"> 
							<a href="${ctx}/info/infoManage?header_Identification=project">项目信息</a>
						</shiro:hasPermission>
					</dd>
					<dd>
						<shiro:hasPermission name="project:planManage"> 
							<a href="${ctx}/planManage/planManage?header_Identification=project">计划管理</a>
						</shiro:hasPermission>
					</dd>
					<dd>
						<shiro:hasPermission name="project:changeManage">
							<a href="${ctx}/changeManage/list?header_Identification=project">计划变更</a>
						</shiro:hasPermission>
					</dd>
				</dl></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="check:-">  
			<li class="layui-nav-item"><a href="javascript:void(0);">考核管理</a>
				<dl class="layui-nav-child">
				<shiro:hasPermission name="check:planList">
					<dd>
						<a href="${ctx }/plan/planList?header_Identification=assessment">计划考核结果</a>
					</dd>
				</shiro:hasPermission>
				<shiro:hasPermission name="check:planTaskList">
					<dd>
						<a href="${ctx }/planTask/planTaskCheckList?header_Identification=assessment">任务考核结果</a>
					</dd>
				</shiro:hasPermission>
				</dl></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="statistical:-">
			<li class="layui-nav-item"><a href="javascript:void(0);">统计查询</a>
				<dl class="layui-nav-child">
					<shiro:hasPermission name="sys:NodeQuery"> 
						<dd>
							<a href="${ctx }/plan/getCodepage?header_Identification=search">节点查询</a>
						</dd>
					</shiro:hasPermission>
					<shiro:hasPermission name="sys:reportRemind"> 
					<dd>
						<a href="${ctx }/remind/getRemindpage?header_Identification=search">填报提醒</a>
					</dd>
					</shiro:hasPermission>
					<shiro:hasPermission name="sys:reportHistory"> 
					<dd>
						<a href="${ctx }/record/getRecordpage?header_Identification=search">填报记录</a>
					</dd>
					</shiro:hasPermission>
				</dl></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="repository:-">
			<li class="layui-nav-item"><a href="javascript:void(0);">知识库管理</a>
				<dl class="layui-nav-child">
					<shiro:hasPermission name="repo:repoType">
						<dd>
							<a href="${ctx }/repositoryType/repositoryTypeList?header_Identification=knowledge">知识库分类管理</a>
						</dd>
					</shiro:hasPermission>
					<shiro:hasPermission name="repo:repo">
						<dd>	
							<a href="${ctx }/repository/repositoryList?header_Identification=knowledge">知识库管理</a>
						</dd>
					</shiro:hasPermission>
				</dl></li>
			</shiro:hasPermission>
			<shiro:hasPermission name="sys:-">  
			<li class="layui-nav-item"><a href="javascript:void(0);">系统设置</a>
				<dl class="layui-nav-child">
					<shiro:hasPermission name="sys:userList"> 
					<dd>
						<a href="${ctx }/user/userManage?header_Identification=system">用户管理</a>
					</dd>
					</shiro:hasPermission>
					<shiro:hasPermission name="sys:roleList"> 
					<dd>
						<a href="${ctx }/role/roleManage?header_Identification=system">角色管理</a>
					</dd>
					</shiro:hasPermission>
					<shiro:hasPermission name="sys:sysParameter"> 
					<dd>
						<a href="${ctx}/sys/querypage?header_Identification=system">系统参数设置</a>
					</dd>
					</shiro:hasPermission>
					
					<shiro:hasPermission name="sys:standardPost">
					<dd>
						<a href="${ctx }/post/postManage?header_Identification=system">标准岗位</a>
					</dd>
					</shiro:hasPermission>
					
					<shiro:hasPermission name="line:list">
					<dd>
						<a href="${ctx }/responsibilitiesline/list?header_Identification=system">职能线管理</a>
					</dd>
					</shiro:hasPermission>
				</dl></li>
				</shiro:hasPermission>
		</ul>
<%-- 		<ul class="layui-nav layui-layout-right">
			<li class="newslityle">
				${currentUser.username }
				
			</li>
			<li class="newslityle"><a href="javascript:;"> 
				<a href="javascript:void(0);" onclick="logout();">
					<img src="${ctx }/img/logout.png" style="width: 13px;height: 13px;margin-top: -3px;">&nbsp;
					<span style="color: #fff;">退出</span>
					
				</a>
			</li>
			<li class="newslityle">
				<select>
					<c:forEach items="${usersCompany }" var="company">
						<option value="${company.pkCompany }">${company.companyName }</option>
					</c:forEach>
				</select>
			</li>
		</ul> --%>
		<ul class="layui-nav layui-layout-right">
			<li class="newslityle" style="width:100%;height:30px;line-height:30px;text-align:right;">
				${currentUser.username }&nbsp;&nbsp;&nbsp;&nbsp;
				<a href="javascript:void(0);" onclick="logout();">
					<img src="${ctx }/img/logout.png" style="width: 13px;height: 13px;margin-top: -3px;">&nbsp;
					<span style="color: #fff;">退出</span>
					
				</a>
			</li>
			<li class="newslityle" style="width:100%;height:30px;line-height:30px;text-align:right;"> 
				<p id="companyName"  style="cursor: pointer;">
					<span onclick="changeComany(this)">
						<c:choose>
							<c:when test="${group =='group' }">
								实地集团 &nbsp;
								<i class="layui-icon" style="font-size: 13px; color: #FFFFFF;">&#xe61a;</i> 
							</c:when>
							<c:otherwise>
								${operatedCompany.companyName }&nbsp;
								<c:if test="${operatedCompany.companyName !=null && operatedCompany.companyName !=''}">
									<i class="layui-icon" style="font-size: 13px; color: #FFFFFF;">&#xe61a;</i> 
								</c:if>
							</c:otherwise>
						</c:choose>
					</span>
				</p>
			</li>
		</ul>
		
	</div>
</body>
</html>